package com.example.wanbaqian.adapter;

import android.content.Context;
import android.view.View;

import com.example.wanbaqian.R;
import com.example.wanbaqian.bean.AllRepaylistBean;
import com.example.wanbaqian.utils.TimeUtils;
import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;
import com.zhy.autolayout.utils.AutoUtils;

import java.util.List;

/**
 * Created by pengfei on 2017/8/12 0012.
 * description：<p>还款列表</p>
 */

public class AllRepayListAdpter extends CommonAdapter<AllRepaylistBean>{

    public AllRepayListAdpter(Context context, int layoutId, List<AllRepaylistBean> datas) {
        super(context, layoutId, datas);
    }

    @Override
    public void onViewHolderCreated(ViewHolder holder, View itemView) {
        super.onViewHolderCreated(holder, itemView);
        AutoUtils.autoSize(itemView);
    }

    @Override
    protected void convert(ViewHolder holder, AllRepaylistBean item, int position) {
        holder.setText(R.id.orderid,"订单号："+item.getRepay_no());
        if(item.getOverdue_days().equals("0")){
            holder.setText(R.id.txt_repaytype,"去还款");
            holder.setText(R.id.txt_timetype,"距还款日");
            holder.setText(R.id.todaynums,item.getPay_days());
        }else if(item.getPay_days().equals("0")){
            holder.setText(R.id.txt_repaytype,"已逾期");
            holder.setText(R.id.txt_timetype,"逾期天数");
            holder.setText(R.id.todaynums,item.getOverdue_days());
        }
        holder.setText(R.id.shouldrepaymoney,item.getRepay_amount());
        holder.setText(R.id.txt_date1,TimeUtils.getStringnumber(item.getRepay_end_time()));
        holder.setText(R.id.txt_data2, TimeUtils.getStringData(item.getRepay_end_time()));
    }
}
